Conversation
|
Thank you for pull, it looks reasonable as to fix, I am not sure if it doesn't influences anything else, can you explain those two test changes? |
|
My apologies - both of those tests failed originally for me as they crossed DST changes in North America. I had "commented" them out by switching the dates. That should have been changed back prior to the original push - corrected. |
|
I think this breaks something else, I need to look into it deeper. Main issue is that underlying time implementation from libc is not good in general (both glibc and musl). So it is really hard to build on top of it. |
|
I'm certainly not an expert so I can appreciate the caution here. The beauty is that I can move right along in my little world with my patch and be very happy - open source at its finest! |
|
I will look into this more so see what can be done about DST changes across different timezones. |
|
When I had the need to use timezones, local time did not work for me so I have implemented my own function to deal with time zones and handle DST and the the edge cases around changes. For this to work, I set local time to false in cmake When the user creates a cron string, they have to specify the timezone in which they want it executed. The function converts to UTC so one scheduler can handle different timezones. |
|
I implemented some DST and other fixes, I took some ideas from here.
|
|
I specifically added Toronto timezone in the matrix tests. Added DST tests from this pull. I moved is_dst and some other fixes to relaxed mode as well, they should be there. To run that timezone specifically: |
|
Improved musl compatibility. |
This addresses an issue with the crossing of daylight savings time boundaries.
Specifically the test on line 912 skips the entire day of 3/10/2019 without the fix.
As I believe I understand the issue is as follows (for the test on line 912)
The code creates a struct tm on 3/9 and then as it works to locate the next time (which should be 3/10 at 6AM) - it sets the struct to 23:00 on 3/10 (to change days) but it has the isdst flag as 0.
Then the system (i.e. not this library) reads that time and readjusts the struct to 0 hours on 3/11 with the isdst flag as 1.
The code then zeros out the hours and tries to start looking for the next match. But it's jumped over the 10th due to the daylight savings jump, obviously not the desired situation.
Switching the isdst flag to -1 when we set a field allows the system to properly switch into the 10th and therefore the struct gets to the correct spot and works properly.